<template>
    <el-transfer
    filterable
    :titles=titles
    :filter-method="filterMethod"
    filter-placeholder="请输入搜索内容"
    v-model="value"
    :data="data">
  </el-transfer>
</template>

<script>
export default {
    name:"transfer",
    data() {
      const generateData = _ => {
        const data = [];
        const cities = ['上海', '北京', '广州', '深圳', '南京', '西安', '成都'];
        const pinyin = ['shanghai', 'beijing', 'guangzhou', 'shenzhen', 'nanjing', 'xian', 'chengdu'];
        cities.forEach((city, index) => {
          data.push({
            label: city,
            key: index,
            pinyin: pinyin[index]
          });
        });
        return data;
      };
      return {
          titles:['未拥有','已拥有'],
        data: generateData(),
        value: [],
        filterMethod(query, item) {
          return item.pinyin.indexOf(query) > -1;
        }
      };
    },
    props:{
        roleMenu:{
            type:Array
        }
    }
  };
</script>

<style>

</style>